import random


def random_n_score():
    return [random.randint(0, 751) for i in range(random.randint(20000, 500000))]


def calculate_enroll_score(rate: int, scores: list):
    all_number = len(scores)
    enroll_number = int(round(all_number * rate / 100, 0))
    scores.sort(reverse=True)
    enroll_score = scores[enroll_number - 1]
    return enroll_score


def calculate_enroll_rate(score: int, scores: list):
    all_number = len(scores)
    enroll_scores = list(filter(lambda e: e >= score, scores))
    enroll_number = len(enroll_scores)
    enroll_rate = round(enroll_number / all_number, 2)
    return "{}%".format(int(enroll_rate * 100))


while True:
    print("1.录取线(200-750)，2.录取率(10-100)")
    print("示例：1 530")
    print("示例：2 40")
    ins = input("请输入：")
    choice, number = ins.split(" ")
    number = int(number)
    if choice == '1':
        scores = random_n_score()
        enroll_rate = calculate_enroll_rate(number, scores)
        print("录取线：{}，本届考试人数：{}，求得录取率：{}".format(number, len(scores), enroll_rate))
    elif choice == '2':
        scores = random_n_score()
        enroll_score = calculate_enroll_score(number, scores)
        print("录取率：{}，本届考试人数：{}，录取线：{}".format(number, len(scores), enroll_score))
    else:
        print("数据格式不对，请重新输入")
